using Domain.Dto;
using Gmmy.DomainExtension;
using System;
using System.Linq.Expressions;

namespace Domain.Specification
{
    public class SampleModelListSpecification : Specification<SampleModelListInput>
    {
        public string Title { get; set; }


        public SampleModelListSpecification(SampleModelListInput input)
        {
            Title = input.Title;

        }

		/// <summary>
        /// 查询规约
        /// </summary>
        /// <returns></returns>
        public override Expression<Func<SampleModelListInput, bool>> SatisfiedBy()
        {
            var where = PredicateBuilder.True<SampleModelListInput>().And(x => !x.IsDeleted);
            if (!string.IsNullOrEmpty(Title))
            {
                where = where.And(x => x.Title.Contains(Title));
            }

            return where;
        }
    }
}
